package com.hong.chapter1;

public class Singleton {
    private static Singleton instance =new Singleton();

    public static int x = 0;

    public static int y;



    /**
     * int x = 0;
     * int y = 0;
     * intstance =null;
     */
    /**1.instance =null;
     * x=0;\
     * x=0;
     *
     * instance = new Singleton();
     * x++=>x=1;
     * x++=>y=1;
     *
     * x=0;
     * y=1;
     */
    public Singleton() {
        x++;
        y++;

    }

    public static  Singleton getInstance(){
        return  instance;
    }

    public static void main(String[] args) {
        Singleton singleton = getInstance();
        System.out.println(singleton.x);
        System.out.println(singleton.y);
    }
}
